package com.tg.app.activity.device.add;

import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.Button;
import android.widget.CheckBox;

import androidx.annotation.Nullable;

import com.base.BaseActivity;
import com.tange.feature.data.structure.DeviceTypeBean;
import com.tg.app.R;
import com.tg.app.helper.ActivityHelper;

public class ResetErrorDeviceActivity extends BaseActivity {
    private Button mButton;
    private String mUUID;
    private DeviceTypeBean deviceTypeBean;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);//remove title bar  即隐藏标题栏
        setContentView(R.layout.activity_reset_device_desc);
        Intent intent = getIntent();
        if (intent != null){
            mUUID = intent.getStringExtra(ApSetWifiActivityEx.EXT_WIFI_UUID);
            deviceTypeBean = intent.getParcelableExtra(DeviceTypeBean.DEVICE_TYPE_BEAN);
        }
        hideActionBar();
        initView();
    }
    @Override
    public boolean shouldSetStatusBarColor() {
        return true;
    }
    protected void initView() {
        mButton = findViewById(R.id.next);
        ActivityHelper.setLoginStyleButtonEnable(mButton, false);
        mButton.setOnClickListener(v -> ActivityHelper.goToBindActivity(ResetErrorDeviceActivity.this, mUUID, ScanQrcodeActivity.EXT_FROM_SHOULD_RESET, deviceTypeBean));

        CheckBox checkBox = findViewById(R.id.cb_message_filter_device_all);
        checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> ActivityHelper.setLoginStyleButtonEnable(mButton, isChecked));
        modifyToolBar(null, false);
        findViewById(R.id.back_toolbar).setOnClickListener(v -> {
            Intent toAddChoose = new Intent(ResetErrorDeviceActivity.this, ScanQrcodeActivity.class);
            startActivity(toAddChoose);
            finish();
        });
    }

    @Override
    public void onBackPressed() {
        Intent toAddChoose = new Intent(ResetErrorDeviceActivity.this, ScanQrcodeActivity.class);
        startActivity(toAddChoose);
        finish();
    }

}